
package wusiyuan.dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import entity.User_Address;
import util.C3P0Util;
import wusiyuan.dao.ChangeTheAddressDao;

public class ChangeTheAddressDaoImpl implements ChangeTheAddressDao{



	@Override
	public Integer ChangeTheAddress(User_Address ua,Integer User_Address_ID) {
		Integer i=0;
		QueryRunner qr = new QueryRunner(C3P0Util.getDataSource());	
		String sql = "UPDATE user_addr SET consignee = ? ,phone = ? ,zip_code = ? , "
				+ "sex = ? ,province = ?, city = ?,district = ?,address = ?,"
				+ "remark = ?,is_default= ?"
				+ " WHERE user_addr_id = ? ";
		Object[] pram ={ua.getConsignee(),ua.getPhone(),ua.getZip_code(),ua.getSex(),
				ua.getProvince(),ua.getCity(),ua.getDistrict(),ua.getAddress(),
				ua.getRemark(),ua.getIs_default(),User_Address_ID};
		try {
			i = qr.update(sql, pram);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return i;
	}
  
	
	
}
